import { _decorator, Component, Label, Node } from 'cc';
import { UIManager } from './UIManager';
import { EventManager } from '../event/EventManager';
const { ccclass, property } = _decorator;

@ccclass('UIHeader')
export class UIHeader extends Component {

    @property(Label)
    title:Label
    @property(Node)
    back:Node
    @property(Node)
    close:Node

   
    
    start() {
        this.back.on(Node.EventType.TOUCH_END, this.onClose, this)
        this.close.on(Node.EventType.TOUCH_END, this.onClose, this)
    }

    setData(title:string){
        this.title.string = title
        
    }   

    onClose(){
       
        EventManager.instance.emit(this.title.string + 'close', '')
    }
}


